package com.yungu.swift.socket.communication.server.handler.strategy;

import com.google.gson.Gson;
import com.yungu.swift.constants.SocketConstant;
import com.yungu.swift.socket.communication.message.base.Message;
import com.yungu.swift.socket.component.ChannelKeeper;
import io.netty.channel.ChannelHandlerContext;

/**
 * 后台订单来电
 *
 * @author : cuixiuyin
 * @date : 2019/8/30
 */
public class JoinOrderCallHandler implements MessageHandler {

    @Override
    public void handler(ChannelHandlerContext channelHandlerContext, String text) {
        Message message = new Gson().fromJson(text, Message.class);
        ChannelKeeper.add(SocketConstant.PUSH_ADMIN_PREFIX_ORDER_CALL + SocketConstant.PUSH_ADMIN_SEPARATOR
                + message.getClientUuid() + SocketConstant.PUSH_ADMIN_SEPARATOR
                + channelHandlerContext.channel().id().asLongText(), channelHandlerContext.channel());
    }
}
